﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text;

public partial class Rep_Table : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        double num = 3452;// 34.234665671282;

        //string rs = getDouble(num, 3);

        //Response.Write(rs);

        // Response.Write(DateTime.Now.ToString());



        BLL.BLLRep bll = new BLL.BLLRep();

        //string dl = bll.getDl("C02", "2012-09-20 23:59:59.0", "2012-09-21 23:59:59.0");



        string dl = bll.getDl("C02", "2012-09-20 0:00:00.0", "2012-09-21 0:00:00.0");
    }


    public double getDouble(double result, int num)
    {
        string res = result.ToString();
        string results = "";
        int index = res.IndexOf('.');

        if (index > 0)
        {
            index += num;

            res = res.Remove(0, index + 1);
            results = result.ToString().Substring(0, index + 1);
            res = res.Substring(0, 1);

            string point = "0.";

            for (int count = 0; count < num - 1; count++)
            {
                point += "0";
            }
            point += "1";


            if (Convert.ToInt32(res) > 4)
            {
                results = (Convert.ToDouble(results) + Convert.ToDouble(point)).ToString();
                res = results;
            }
            else
            {
                res = results;
            }
        }
        else
        {
            res += ".";
            for (int i = 0; i < num; i++)
            {
                res += "0";
            }
        }
        return Convert.ToDouble(res);
    }
}
